<script setup lang="ts">
import MobileNav from './mobile/index.vue'
import PcNav from './pc/index.vue'
import { isMobileTerminal } from '~/utils/flexble'
import { getCategory } from '~/api/category'
import type { CategoryItem } from '~/api/category'
import { ALL_CATEGOTY_INTM } from '~/constants'

const categoryData = ref<CategoryItem[]>([])

const getCategoryData = async () => {
  const { categories } = await getCategory()
  categoryData.value = categories
  categoryData.value.unshift(ALL_CATEGOTY_INTM)
}

getCategoryData()
</script>

<template>
  <MobileNav v-if="isMobileTerminal" :data="categoryData" />
  <PcNav v-else />
</template>
